import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  build: {
    rollupOptions: {
      // 把 ElementPlus 拆包，减少首屏
      external: ['@element-plus/icons-vue'],
      output: {
        manualChunks: {
          element: ['element-plus']
        }
      }
    },
    gzipSize: true,
    brotliSize: true
  },
  server: {
    open: false,
    port: 5173
  }
})